﻿<Window x:Class="CodeSHARPer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:avalonDockProperties="clr-namespace:AvalonDock.Properties;assembly=AvalonDock"
        xmlns:avalonDock="http://avalondock.codeplex.com"
        xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=AvalonDock"

        xmlns:pane="clr-namespace:CodeSHARPer.Avalondock.Pane"
        xmlns:adlayout="clr-namespace:CodeSHARPer.Avalondock"
        xmlns:local="clr-namespace:CodeSHARPer"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:sysWindows="clr-namespace:System.Windows;assembly=PresentationCore"

        xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonEdit"

        xmlns:behav="clr-namespace:CodeSHARPer.Behaviour"
        xmlns:tools="clr-namespace:CodeSHARPer.View.Tools"
        xmlns:view="clr-namespace:CodeSHARPer.View"
        xmlns:conv="clr-namespace:CodeSHARPer.Converter"
        xmlns:cmd="clr-namespace:CodeSHARPer"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        mc:Ignorable="d" 
        d:DesignHeight="300" d:DesignWidth="700"
        Icon="Themes\Images\App\Ico\app.icon.ico"
        Title="{Binding ApplicationTitle}" Background="{x:Null}" WindowState="Maximized">

    <Window.Resources>
        <conv:ActiveDocumentConverter x:Key="ActiveDocumentConverter"/>
        <avalonDock:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
        <conv:BooleanToTypeModeStringConverter x:Key="DisplayTypeModeConverter" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <MenuItem Header="_File">
                <MenuItem Header="New" Command="New">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageNew}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Open" Command="Open">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageOpen}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Save" Command="Save" ToolTipService.ShowOnDisabled="True" >
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageSave}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Save As..." Command="SaveAs">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageSave}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem ItemsSource="{Binding RecentFiles.OpenedFilesManager.LastOpenedFiles}" Header="Recent Files"
                          Visibility="{Binding Path=RecentFiles.OpenedFilesManager.LastOpenedFiles, Mode=OneWay, Converter={conv:ZeroToVisibilityConverter}}">
                    <MenuItem.ItemContainerStyle>
                        <Style TargetType="MenuItem">
                            <Setter Property="Header" Value="{Binding FileName, Mode=OneWay}" />
                            <Setter Property="ToolTip" Value="{Binding PathFileName, Mode=OneWay}" />
                            <Setter Property="Command" Value="cmd:AppCommand.LoadFile" />
                            <Setter Property="CommandParameter" Value="{Binding PathFileName, Mode=OneWay}" />
                        </Style>
                    </MenuItem.ItemContainerStyle>
                </MenuItem>
                <MenuItem Header="Preferences" Command="cmd:AppCommand.Preferences" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageTools}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Close" Command="cmd:AppCommand.CloseFile"
                                 CommandParameter="{Binding ActiveDocument}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageClose}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Exit" Command="cmd:AppCommand.Exit" />
            </MenuItem>
            <MenuItem Header="_Edit">
                <MenuItem Header="Cut" Command="Cut"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageCut}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Copy" Command="Copy"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageCopy}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Paste" Command="Paste"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImagePaste}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Delete" Command="Delete"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" ToolTipService.ShowOnDisabled="True">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageDelete}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Command="cmd:AppCommand.SelectAll" Header="Select All"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
                <Separator/>
                <MenuItem Header="Go to line..." Command="cmd:AppCommand.GotoLine"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
                <MenuItem Header="Find" Command="cmd:AppCommand.FindText"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageEditFind}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Replace..." Command="cmd:AppCommand.ReplaceText"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
                <Separator/>
                <MenuItem Header="Zoom+" Command="cmd:AppCommand.IncreaseFontSize"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageMagnifyAdd}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Zoom-" Command="cmd:AppCommand.DecreaseFontSize"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageMagnifyMinus}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Normal" Command="cmd:AppCommand.NormalFontSize"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageMagnify}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="References" Command="cmd:AppCommand.References" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource ImageReferences}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Format document" Command="cmd:AppCommand.FormatDocumentCode" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource FormatDocument}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Format selection" Command="cmd:AppCommand.FormatSelectionCode" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource FormatSelection}" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="_View">
                <MenuItem Header="Show/Hide Toolbar" Command="cmd:AppCommand.ToogleToolbar"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
                <MenuItem Header="Show/Hide Output" Command="cmd:AppCommand.ToogleOutput"
                          ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
            </MenuItem>
            <MenuItem Header="_Tools">
                <MenuItem Header="Recent Files" IsChecked="{Binding RecentFiles.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
                <MenuItem Header="Working Folder" IsChecked="{Binding WorkingFolder.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="About" Command="cmd:AppCommand.About" />
            </MenuItem>
        </Menu>

        <ToolBarTray Grid.Row="1" SnapsToDevicePixels="True" Visibility="{Binding IsToolBarVisible, Converter={StaticResource BoolToVisibilityConverter}}" Background="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" >
            <ToolBar VerticalAlignment="Stretch" ToolBarTray.IsLocked="True" DockPanel.Dock="Left" SnapsToDevicePixels="True" ClipToBounds="True" Background="Transparent">
                <Button Command="New" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageNew}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="Open" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageOpen}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="Save" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageSave}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="cmd:AppCommand.SaveAll" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageSaveAll}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Separator Margin="3" SnapsToDevicePixels="True" />
                <Button Command="Copy" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageCopy}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="Cut" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageCut}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="Paste" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImagePaste}" Height="24" SnapsToDevicePixels="True" />
                </Button>
                <Button Command="Delete" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageDelete}" Height="24"/>
                </Button>
                <Separator Margin="3"/>
                <Button Command="Undo" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageUndo}" Height="24"/>
                </Button>
                <Button Command="Redo" SnapsToDevicePixels="True"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageRedo}" Height="24"/>
                </Button>
                <Separator Margin="3"/>
                <Button Command="cmd:AppCommand.RunCode"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource ImageRun}" Height="24"/>
                </Button>
                <Separator Margin="3"/>
                <Button Command="cmd:AppCommand.FormatDocumentCode"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource FormatDocument}" Height="24"/>
                </Button>
                <Button Command="cmd:AppCommand.FormatSelectionCode"
                        ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}">
                    <Image Source="{StaticResource FormatSelection}" Height="24"/>
                </Button>
                <Separator />
                <ComboBox x:Name="ComboTheme" SelectedIndex="{Binding ThemeID, Mode=TwoWay}" Width="100">
                    <ComboBoxItem Content="Generic" />
                    <ComboBoxItem Content="Aero">
                        <ComboBoxItem.Tag>
                            <avalonDock:AeroTheme />
                        </ComboBoxItem.Tag>
                    </ComboBoxItem>
                    <ComboBoxItem Content="VS2010">
                        <ComboBoxItem.Tag>
                            <avalonDock:VS2010Theme />
                        </ComboBoxItem.Tag>
                    </ComboBoxItem>
                    <ComboBoxItem Content="Metro">
                        <ComboBoxItem.Tag>
                            <avalonDock:MetroTheme />
                        </ComboBoxItem.Tag>
                    </ComboBoxItem>
                    <ComboBoxItem Content="Express Dark">
                        <ComboBoxItem.Tag>
                            <avalonDock:ExpressionDarkTheme />
                        </ComboBoxItem.Tag>
                    </ComboBoxItem>
                    <ComboBoxItem Content="Express Light">
                        <ComboBoxItem.Tag>
                            <avalonDock:ExpressionLightTheme />
                        </ComboBoxItem.Tag>
                    </ComboBoxItem>
                </ComboBox>
            </ToolBar>
        </ToolBarTray>

        <avalonDock:DockingManager
            x:Name="dockManager" 
            AnchorablesSource="{Binding Tools}" 
            DocumentsSource="{Binding Files}"
            ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}"
            Theme="{Binding ElementName=ComboTheme, Path=SelectedItem.Tag}"
            Grid.Row="2"
            AllowDrop="True"
            behav:DropFileCommand.DropCommand="cmd:AppCommand.LoadFile">

            <!-- header template -->
            <avalonDock:DockingManager.DocumentHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
                        <!-- Show IsReadOnly Icon if that properties' true -->
                        <Image Source="{StaticResource ImageDocTabReadOnly}"
                               Margin="3,0,0,0"
                               Visibility="{Binding Content.IsReadOnly, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                               ToolTip="{Binding Content.IsReadOnlyReason}"
                               VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </avalonDock:DockingManager.DocumentHeaderTemplate>

            <!-- context menu -->
            <avalonDock:DockingManager.DocumentContextMenu>
                <ContextMenu>
                    <MenuItem Header="Open Containing Folder..." 
                              Command="{Binding Model.OpenContainingFolderCommand}"/>
                    <MenuItem Header="Copy URL to Clipboard" 
                              Command="{Binding Model.CopyFullPathtoClipboard}"/>
                    <Separator/>
                    <MenuItem Header="{x:Static avalonDockProperties:Resources.Document_Close}" 
                              Command="{Binding Path=CloseCommand}"
                              Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"/>
                    <MenuItem Header="{x:Static avalonDockProperties:Resources.Document_CloseAllButThis}" 
                              Command="{Binding Path=CloseAllButThisCommand}"/>
                    <MenuItem Header="{x:Static avalonDockProperties:Resources.Document_Float}" 
                              Command="{Binding Path=FloatCommand}"/>
                    <MenuItem Header="{x:Static avalonDockProperties:Resources.Document_DockAsDocument}" 
                              Command="{Binding Path=DockAsDocumentCommand}"/>
                    <MenuItem Header="{x:Static avalonDockProperties:Resources.Document_NewHorizontalTabGroup}"
                              Command="{Binding Path=NewHorizontalTabGroupCommand}"
                              Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"/>
                </ContextMenu>
            </avalonDock:DockingManager.DocumentContextMenu>

            <avalonDock:DockingManager.LayoutItemTemplateSelector>
                <pane:PanesTemplateSelector>
                    <pane:PanesTemplateSelector.FileViewTemplate>
                        <DataTemplate>
                            <view:CodePadView
                                Grid.Row="1"
                                SyntaxHighlighting="{Binding HighlightingDefinition, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                EditorCaretOffset="{Binding TextEditorCaretOffset, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                EditorSelectionLength="{Binding TextEditorSelectionLength, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                EditorSelectionStart="{Binding TextEditorSelectionStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                EditorIsRectangleSelection="{Binding TextEditorIsRectangularSelection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                
                                FontSize="{Binding FontSize.SelectedFontSize}"
                                ShowLineNumbers="{Binding ShowLineNumbers, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                
                                IsModified="{Binding IsDirty, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                IsReadOnly="{Binding IsReadOnly}"
                                
                                TextBoxController="{Binding TxtControl}"
                                Line="{Binding Line, Mode=OneWayToSource}"
                                Column="{Binding Column, Mode=OneWayToSource}"/>
                        </DataTemplate>
                    </pane:PanesTemplateSelector.FileViewTemplate>

                    <pane:PanesTemplateSelector.RecentFilesViewTemplate>
                        <DataTemplate>
                            <tools:RecentFilesView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.RecentFilesViewTemplate>

                    <pane:PanesTemplateSelector.WorkingFolderViewTemplate>
                        <DataTemplate>
                            <tools:WorkingFolderView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.WorkingFolderViewTemplate>

                    <pane:PanesTemplateSelector.FindAndReplaceViewTemplate>
                        <DataTemplate>
                            <tools:FindReplaceView/>
                        </DataTemplate>
                    </pane:PanesTemplateSelector.FindAndReplaceViewTemplate>
                </pane:PanesTemplateSelector>
            </avalonDock:DockingManager.LayoutItemTemplateSelector>

            <avalonDock:DockingManager.LayoutItemContainerStyleSelector>
                <pane:PanesStyleSelector>
                    <pane:PanesStyleSelector.FileStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="{Binding Model.FilePath}"/>
                            <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            <Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.FileStyle>
                    <pane:PanesStyleSelector.ToolsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="{Binding Model.FilePath}"/>
                            <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.ToolsStyle>
                </pane:PanesStyleSelector>
            </avalonDock:DockingManager.LayoutItemContainerStyleSelector>
            <avalonDock:DockingManager.LayoutUpdateStrategy>
                <adlayout:LayoutInitializer/>
            </avalonDock:DockingManager.LayoutUpdateStrategy>

            <avalonDock:LayoutRoot>
                <avalonDock:LayoutPanel>
                    <avalonDock:LayoutAnchorablePane DockWidth="350"/>
                    <avalonDock:LayoutDocumentPane/>
                </avalonDock:LayoutPanel>
            </avalonDock:LayoutRoot>
        </avalonDock:DockingManager>

        <StatusBar Grid.Row="3" HorizontalAlignment="Stretch">
            <StatusBarItem HorizontalAlignment="Stretch">
                <TextBlock Text="Ready."
                   Grid.Column="0" Margin="0,0,3,0" HorizontalAlignment="Stretch"/>
            </StatusBarItem>

            <StatusBarItem HorizontalAlignment="Right">
                <Grid Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Grid Grid.Column="0" Margin="3,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Line"
                                   Margin="3,0" Grid.Column="0"/>
                        <TextBlock Text="{Binding ActiveDocument.Line, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                   Margin="3,0" Grid.Column="1" MinWidth="60" HorizontalAlignment="Left" />
                    </Grid>

                    <Grid Grid.Column="1" Margin="3,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Column"
                                   Margin="3,0" Grid.Column="0"/>
                        <TextBlock Text="{Binding ActiveDocument.Column, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                       Margin="3,0" Grid.Column="1" MinWidth="60" HorizontalAlignment="Left" />
                    </Grid>

                    <TextBlock Text="{Binding TextOptions.IsInsertMode,Converter={StaticResource DisplayTypeModeConverter}, Mode=OneWay}"
                               DataContext="{Binding ActiveDocument}" Margin="3, 0" Grid.Column="2"/>
                </Grid>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
